<?php

namespace app\admin\model;

use support\Model;

class ApiDesc extends Model
{
    public $timestamps = false;

    protected $fillable = [
        'key',
        'title',
        'summary',
        'route',
        'method',
        'group_id',
        'weigh',
        'params',
        'returns',
        'return_params',
        'headers',
        'return_headers',
    ];

    protected $visible = [
        'key',
        'title',
        'summary',
        'route',
        'method',
        'group_id',
        'weigh',
        'params',
        'returns',
        'return_params',
        'headers',
        'return_headers',
    ];

    protected $casts = [
        'params' => 'array',
        'returns' => 'array',
        'return_params' => 'array',
        'headers' => 'array',
        'return_headers' => 'array',
    ];

    public function apigroup() {
        return $this->belongsTo(ApiGroup::class, 'group_id');
    }
}
